package com.example.mylayoutapp;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;

public class ActivityOne extends Activity {

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.action_save:
			Intent callingIntent = getIntent();
			callingIntent.putExtra("myResult", "I was on Activity (1)");
			
			
			setResult(RESULT_OK, callingIntent);
			finish();
			return true;

		case R.id.action_cancel:
			setResult(RESULT_CANCELED);
			finish();
			return true;
		}
		
		return false;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_one);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_one, menu);
		return true;
	}

}
